﻿using System;
using System.Collections.Generic;
using System.Text;

namespace PacMan3D.Utils
{
    /// <summary>
    /// This class represents a Vector composed by floats.
    /// </summary>
    public class Vector
    {
        public float X { get; set; }
        public float Y { get; set; }
        public float Z { get; set; }

        public Vector() {}
        
        public Vector(float x, float y, float z)
        {
            this.X = x;
            this.Y = y;
            this.Z = z;
        }

        public Vector Rotate90XZ()
        {
            return new Vector(-this.Z, 0.0f, this.X);
        }

        public Vector Rotate270XZ()
        {
            return new Vector(this.Z, 0.0f, -this.X);
        }

        public void UpdateOnlyX(float value)
        {
            this.X = value;
            this.Y = this.Z = 0.0f;
        }

        public void UpdateOnlyZ(float value)
        {
            this.X = this.Y = 0.0f; 
            this.Z = value;
        }

        public Vector Clone()
        {
            return new Vector(this.X, this.Y, this.Z);
        }

        public static Vector GetVector(Point3D p1, Point3D p2)
        {
            return new Vector(p2.X - p1.X, p2.Y - p1.Y, p2.Z - p1.Z);
        }

        public override string ToString()
        {
            return "Vector{X: " + this.X + ", Y: " + this.Y + ", Z: " + this.Z + "}";
        }
    }
}
